package cn.zust.itcost.repository;

import cn.zust.itcost.entity.graph.node.TextNode;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;

public interface TextNodeRepository extends Neo4jRepository<TextNode, Long> {
    
    @Query("MATCH (n:Text) WHERE n.source = $source RETURN n")
    List<TextNode> findBySource(@Param("source") String source);
    
    @Query("MATCH (n:Text)-[r:RELATES_TO]->(m:Text) WHERE n.source = $source RETURN n, r, m")
    List<TextNode> findRelationshipsBySource(@Param("source") String source);
    
    @Query("MATCH (n:Text) WHERE n.content CONTAINS $keyword RETURN n")
    List<TextNode> findByContentContaining(@Param("keyword") String keyword);
} 